<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  users
 */

class m_users_actions_block_DashBoardUsersAction extends m_backoffice_extends_Action
{
	public function execute()
	{
            //users infos
            $documentProvider = f_document_Provider::getInstance();
            $arrayUsers = $documentProvider->loadDocuments("modules_users/user")->addDescOrder("document_creationdate")->limit(5)->retrieveDocuments();

            $documentProvider2 = f_document_Provider::getInstance();
            $countAllUsers = $documentProvider2->loadDocuments("modules_users/user")->count();

            //groups infos
            $documentProvider = f_document_Provider::getInstance();
            $arrayGroups = $documentProvider->loadDocuments("modules_users/group")->addDescOrder("document_creationdate")->limit(5)->retrieveDocuments();

            $documentProvider2 = f_document_Provider::getInstance();
            $countAllGroups = $documentProvider2->loadDocuments("modules_users/group")->count();

            $this->addToModel("arrayUsers", $arrayUsers);
            $this->addToModel("arrayGroups", $arrayGroups);
            $this->addToModel("countAllUsers", $countAllUsers);
            $this->addToModel("countAllGroups", $countAllGroups);

            $this->setView("success");
	}
}